package com.xiaofeng.pochi.mapper;

import com.xiaofeng.pochi.pojo.ShopCouponHistory;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created with IntelliJ IDEA
 *
 * @Author: chc
 * @Date: 2022/09/22/20:54
 * @Description:
 */
@Component
public interface ShopCouponHistoryMapper {

    /**
     * 添加
     * @param shopCouponHistory
     */
    void save(ShopCouponHistory shopCouponHistory);


    /**
     * 根据优惠券ID集合和用户名查询
     *
     * @param couponIds
     * @param username
     * @return
     */
    List<ShopCouponHistory> getByCouponIdsAndUsername(@Param("list") List<Long> couponIds,@Param("username") String username);


    /**
     * 根据优惠券ID和用户名查询
     *
     * @param couponId
     * @param username
     * @return
     */
    ShopCouponHistory getByCouponIdAndUsername(@Param("couponId") Long couponId, @Param("username") String username);


    /**
     * 更新优惠卷使用状态
     * */
    void updateToUse(ShopCouponHistory shopCouponHistory);

    /**
     * 根据优惠券ID查询
     * @param id
     * @return
     */
    List<ShopCouponHistory> getByCouponId(Long id);
}
